//
// Created by yewei on 2023/1/4.
//
#include <bits/stdc++.h>

using namespace std;

bool isOK(int n){
    string s = to_string(n);
    reverse(s.begin(),s.end());
    return stoi(s) == n;
}

int main() {
    freopen("../input.txt", "r", stdin);
    int n;
    cin>>n;
    int cnt = 0;
    while(!isOK(n)){
        cnt++;
        string s = to_string(n);
        reverse(s.begin(),s.end());
        n += stoi(s);
    }
    cout<<cnt<<" "<<n;
}
